<template>
	<view class="">

	</view>
</template>

<script>
	export default {
		created() {
			let environment = uni.getStorageSync("environment")
			if (!environment) {
				uni.setStorageSync("environment", "P")
			}
		},
		async mounted() {
			try {
				const token = uni.getStorageSync("AppToken")
				if (token) {
					uni.reLaunch({
						url: "/pages/index/index"
					})
					this.$store.commit('setUserInfo')
					//const userInfo = this.$store.state.userInfo;
					//const supplierInfo = userInfo.supplierInfo;
				} else {
					if (uni.getStorageSync("agree")) {
						uni.reLaunch({
							url: "/pages/login/index"
						})
					} else {
						uni.reLaunch({
							url: "/pages/login/beforLogin"
						})
					}
				}
			} catch (e) {
				if (uni.getStorageSync("agree")) {
					uni.reLaunch({
						url: "/pages/login/index"
					})
				} else {
					uni.reLaunch({
						url: "/pages/login/beforLogin"
					})
				}
				//TODO handle the exception
			}
		}
	}
</script>

<style lang="scss">
</style>